/**
 * @file wa_menu.h
 *
 */

#ifndef _WA_MENU_H
#define _WA_MENU_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
*      INCLUDES
*********************/
#include "wa_conf.h"
#if USE_WA_MENU != 0
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "wa_area.h"
#include "wa_obj.h"
#include "wa_mask_draw.h"
#include "wa_wm.h"
#include "wa_font.h"
#include "wa_image.h"	
#include "wa_anim.h"
#include "wa_malloc.h"
/*********************
*      DEFINES
*********************/


/**********************
*      TYPEDEFS
**********************/
typedef enum
{
	WA_MENU_DIRE_TYPE_NORMAL,
	WA_MENU_DIRE_TYPE_CENTER,
}wa_menu_directory_type;

typedef struct
{
#if USE_WA_ANIM != 0
	wa_anim* anim;
#endif
	wa_result anim_enable;
	uint32_t switch_time_length;

	int32_t start_pos;
	int32_t end_pos;
	int32_t start_cursor_pos_x;
	int32_t end_cursor_pos_x;
	int32_t start_cursor_pos_y;
	int32_t end_cursor_pos_y;
	int32_t start_cursor_width;
	int32_t end_cursor_width;
	int32_t start_scroll_bar_block_pos;
	int32_t end_scroll_bar_block_pos;

	wa_font* font;
	char** option_text;
	char** option_front_text;
	uint32_t option_cnt;

	uint32_t select;
	uint8_t space;
	int32_t pos;
	wa_menu_directory_type dire_type;
	uint8_t dire_offset;

	uint32_t cursor_width;
	uint32_t cursor_hegiht;
	int32_t cursor_pos_x;
	int32_t cursor_pos_y;
	uint8_t cursor_r;

	uint32_t cursor_limit_min;
	uint32_t cursor_limit_max;

	wa_result scroll_bar_enable;
	uint32_t scroll_bar_line_width;
	uint32_t scroll_bar_block_width;
	uint32_t scroll_bar_block_height;
	uint32_t scroll_bar_block_pos;

	wa_gui_color fore_color;
	wa_gui_color back_color;
	wa_result pid;
	wa_result input;
}wa_menu_ext;

/**********************
* GLOBAL PROTOTYPES
**********************/
void wa_menu_module_init(void);
wa_obj* wa_menu_create(wa_obj* par);
void wa_menu_add_option(wa_obj* menu, char* text, char* front_text);
void wa_menu_clear_option(wa_obj* menu);
void wa_menu_set_select(wa_obj* menu, uint32_t select);
uint32_t wa_menu_get_select(wa_obj* menu);
void wa_menu_set_font(wa_obj* menu, wa_font* font);
wa_font* wa_menu_get_font(wa_obj* menu);
void wa_menu_set_space(wa_obj* menu, uint32_t space);
uint32_t wa_menu_get_space(wa_obj* menu);
void wa_menu_set_dire_type(wa_obj* menu, wa_menu_directory_type dire_type);
wa_menu_directory_type wa_menu_get_dire_type(wa_obj* menu);
void wa_menu_set_dire_offset(wa_obj* menu, uint8_t dire_offset);
uint8_t wa_menu_get_dire_offset(wa_obj* menu);
void wa_menu_set_cursor_r(wa_obj* menu, uint8_t cursor_r);
uint8_t wa_menu_get_cursor_r(wa_obj* menu);
void wa_menu_set_cursor_limit_min(wa_obj* menu, uint32_t cursor_limit_min);
uint32_t wa_menu_get_cursor_limit_min(wa_obj* menu);
void wa_menu_set_cursor_limit_max(wa_obj* menu, uint32_t cursor_limit_max);
uint32_t wa_menu_get_cursor_limit_max(wa_obj* menu);
void wa_menu_set_scroll_bar_enable(wa_obj* menu, wa_result scroll_bar_enable);
wa_result wa_menu_get_scroll_bar_enable(wa_obj* menu);
void wa_menu_set_scroll_bar_line_width(wa_obj* menu, uint32_t scroll_bar_line_width);
uint32_t wa_menu_get_scroll_bar_line_width(wa_obj* menu);
void wa_menu_set_scroll_bar_block_width(wa_obj* menu, uint32_t scroll_bar_block_width);
uint32_t wa_menu_get_scroll_bar_block_width(wa_obj* menu);
void wa_menu_set_fore_color(wa_obj* menu, wa_gui_color fore_color);
wa_gui_color wa_menu_get_fore_color(wa_obj* menu);
void wa_menu_set_back_color(wa_obj* menu, wa_gui_color back_color);
wa_gui_color wa_menu_get_back_color(wa_obj* menu);
void wa_menu_set_anim_enable(wa_obj* menu, wa_result anim_enable);
void wa_menu_set_switch_time_length(wa_obj* menu, uint32_t length);
void wa_menu_init_select_pos(wa_obj* menu);
/**********************
*      MACROS
**********************/

#endif

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif

